package com.youku.compiler;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

public class Scanner {

	public static Tokenizer buildTokenizer(String location) {
		try (InputStream is = new FileInputStream(new File(location))) {
			byte[] b = new byte[1024];
			StringBuilder builder = new StringBuilder();
			while (is.read(b, 0, b.length) != -1) {
				builder.append(new String(b));
			}

			Tokenizer t = new Tokenizer(builder.toString());
			t.process();

			return t;

		} catch (IOException e) {
			throw new RuntimeException(e);
		}

	}
}
